package composite_pattern;

// 表示字母的类，继承自字母复合类
public class Letter extends LetterComposite {

    private final char character;

    // 构造函数，初始化字符
    public Letter(char character) {
        this.character = character;
    }

    // 在打印字母之前输出字符
    @Override
    protected void printThisBefore() {
        System.out.print(character);
    }
}

